<!DOCTYPE html>
<html lang="en">
<head>
        <?php include_once VIEWS.'/inc/head.php'; ?>

</head>
<body>
 <div class="box"></div>

    <?php include_once VIEWS.'/inc/header.php'; ?>
    <!--头部导航-->
     <?php include_once VIEWS.'/inc/nav.php'; ?>
     <!--分隔-->
  <div class="wrap clear">
       
    
        <!--banner大图-->
    
        <div class="about clear">
            <div class="contact">
                <div class="contact_top">
                    <span><?php echo $page['content'];?></span>
                </div>
                <div class="about_bot2">
                   <form action="<?php echo site_url('contact/msg');?>" method="post" class="fm">
                    	<div class="form">
                    		<ul>
	                    		<li><input type="text" value="" name="username" id="name" class="inpu" placeholder="姓名"></li>
	                    		<li><input type="text" value="" name="tel" id="tel" class="inpu" placeholder="联系电话"></li>
	                    		<li><input type="text" value="" name="email" id="email" class="inpu" placeholder="邮箱"></li>
	                    		<li><textarea name="" cols="30" rows="4" class="inpu3" placeholder="留言内容"></textarea>
	                    		</li>
	                    		<li class="namwesa"><input type="submit" value="提交留言" name="content" id="msg" class="inpu2"></li>
                    		</ul>
                    	</div>
                    </form>
                </div>
            </div>

        </div>
         
      <!--分隔-->

  </div>





 
    <!--商业区域-->



</body>
</html>
<script> 
$(document).ready(
		function() {
			$(".fm").submit(function(){
           var name = $("#name").val();
           if(name == '姓名'){
        	   var name ='';
           }
           var tel = $("#tel").val();
           if(tel == '联系电话'){
        	   var tel ='';
           }
           var email = $("#email").val();
           if(email =='邮箱'){
        	   var email ='';
           }
           var content = $("#msg").val();
           if(content =='留言内容'){
        	   var content ='';
           }
           
           if(name==""){
               $('input[name=name]').addClass('erreo');
                alert("请正确填写您的姓名");
                return false;
           }else{
                $('input[name=name]').removeClass('erreo')
           }

           var regtel = /^1\d{10}$/;
           if(!regtel.test(tel) || tel==""){
               $('input[name=tel]').addClass('erreo');
                alert("请正确填写您的联系电话");
                return false;
           }else{
                $('input[name=tel]').removeClass('erreo')
           }

           var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; //验证邮箱的正则表达式
           
           if(!reg.test(email)){
                $('td[name=email]').addClass('erreo');
                alert("请正确填写您的邮箱");
               return false;
           }else{
                $('td[name=email]').removeClass('erreo')
           }
           
           if(content==""){
                 $('textarea[name=content]').addClass('erreo');
                  alert("请填写留言内容");
                 return false;
           }else{
                 $('textarea[name=content]').removeClass('erreo')
           }
				});
		});
</script>
